package com.project.easy.common.framework.generator.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.easy.common.framework.generator.entity.FrameworkGeneratorProjectPackage;
import com.project.easy.common.framework.generator.mapper.FrameworkGeneratorProjectPackageMapper;
import  com.project.easy.common.util.exception.business.BusinessException;
import com.project.easy.common.framework.generator.service.IFrameworkGeneratorProjectPackageService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author GreatorMan.cool
 * @since 2021-09-28
 */
@Service
public class FrameworkGeneratorProjectPackageServiceImpl extends ServiceImpl<FrameworkGeneratorProjectPackageMapper, FrameworkGeneratorProjectPackage> implements IFrameworkGeneratorProjectPackageService {
    /**
     * 查询包列表
     *
     * @param projectId 项目ID
     * @return 返回项目包列表
     */
    @Override
    public List<FrameworkGeneratorProjectPackage> queryList(Long projectId) {
        if (Objects.isNull(projectId)) {
            throw  new BusinessException("项目ID为空!");
        }
        QueryWrapper<FrameworkGeneratorProjectPackage> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("project_id", projectId);
        return this.baseMapper.selectList(queryWrapper);
    }
}
